const detailModel = require('@root/model/detail/detail')
const commentModel = require('@root/model/t1/comment')
const merchantModel = require('@root/model/t1/merchant')

class DetailController {
  
  async getDetailData(ctx, next) {
    let response = ''
    await detailModel.find((err, detailData) => {
      if(err) return console.log(
        chalk.red("find cityList error:", err)
      )
      response = JSON.stringify(detailData)
    })
    ctx.body = response
  }

  async getComments(ctx, next) {
    let response = ''
    await commentModel.find((err, comments) => {
      if(err) return console.log(
        chalk.red("find cityList error:", err)
      )
      response = JSON.stringify(comments)
    })
    ctx.body = response
  }


  // 获取商家信息
  async getMerchant(ctx, next) {
    let response = ''
    await merchantModel.find((err, merchant) => {
      if(err) return console.log(
        chalk.red("find cityList error:", err)
      )
      response = JSON.stringify(merchant)
    })
    ctx.body = response
  }
}

module.exports = new DetailController()